# Integer Knob

The integer input knob renders a text field in the Widgetbook UI where you can dynamically enter an int value for a widget property. 
This is particularly useful for properties that require an integer input, such as shown in a notification badge.

## Variants

The integer input knob has two variants:
- `context.knobs.int.input()`: This variant allows you to enter an integer value via a text field. It does not accept `null` values.
- `context.knobs.intOrNull.input()`: This variant allows you to enter an integer value via a text field or set the value to `null`. It is useful when the property can be optional.

<Info>Widgetbook also offers support for slider-based integer knobs which are documented on the [Integer Slider Knob page](/knobs/integer/slider).</Info>

## Properties

Besides the knob's [base properties](/knobs/overview#properties), the integer input knob does not feature any additional properties.

## `context.knobs.int.input()`

### Example

<iframe 
  src="https://preview.widgetbook.io/#/?path=knobpreview/int-input-knob&panels=knobs" 
  width="100%"
  height="240px"
/>

### Usage

To use the integer input knob, call the `context.knobs.int.input()` method.

```dart title="Example: Integer Input Knob"
@UseCase(type: MyWidget, name: 'Default')
Widget buildUseCase(BuildContext context) {
  return MyWidget(
    count: context.knobs.int.input(label: 'count', initialValue: 100), // [!code highlight]
  );
}
```

## `context.knobs.intOrNull.input()` 

### Example

<iframe 
  src="https://preview.widgetbook.io/#/?path=knobpreview/int-input-nullable-knob&panels=knobs" 
  width="100%"
  height="240px"
/>

### Usage

To use the nullable integer input knob, call the `context.knobs.intOrNull.input()` method.

```dart title="Example: Nullable Integer Input Knob"
@UseCase(type: MyWidget, name: 'Default')
Widget buildUseCase(BuildContext context) {
  return MyWidget(
    count: context.knobs.intOrNull.input(label: 'count'), // [!code highlight]
  );
}
```

## Multi-snapshot Support

Multi-snapshot support for Widgetbook Cloud allows you to generate multiple screenshots of a single use case with varying values using [KnobsConfigs](/cloud/snapshots/multi-snapshot#multi-snapshot-for-knobs) and [AddonsConfigs](/cloud/snapshots/multi-snapshot#multi-snapshot-for-addons).
Please refer to the [IntKnobConfig page](/knobs/integer/overview#multi-snapshot-support) for more information.